#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# 检测当前使用的包管理器
executor="pnpm"
if command -v npm &> /dev/null && [ "$npm_execpath" != "" ]; then
  if echo "$npm_execpath" | grep -q "npm"; then
    executor="npm"
  fi
fi

# 执行格式化命令
echo "Using $executor to run format..."
$executor run format

# 确保格式化后的文件被包含在提交中
git add -u
